#pragma once
#include "stdafx.h"
#include "RenderQueue.h"
#define RENDER_DUMP_FILENAME "./log/RenderQueue.txt"
/*
	This class used to group all the renderable object.
	RenderObjectManager manager several render queue.
	each queue have the same speciality. so we won't change
	lotes of directx state or never change any directx state
	when render per queue. Which queue the render object will
	enter in is decied by the effect or something else the render
	object have. 
	And Effect is not implement any more now. so only one render queue
	exists now.
*/

class RenderQueue;
class Component;

class RenderObjectManager : public Component
{
private:
	RenderObjectManager(const RenderObjectManager&);
	
public:
	enum QueueFormat
	{
		QueueMain
	};
	typedef boost::shared_ptr<RenderObjectManager> sPtr;
	typedef boost::unordered_map<QueueFormat, RenderQueue::sPtr, boost::hash<int> > RenderQueueMap;
	RenderObjectManager();
	~RenderObjectManager();
	void AddedToObject();
	void Render();
	void RenderSignleQueue(RenderQueue::sPtr);
	void Dump(const Message&);
	void AddRenderObject(const Message&);
	void RemoveRenderObject(const Message&);
	void RemoveAllQueue(const Message&);
	void Initialize(const Message& msg);
private:
	RenderQueueMap m_renderQueueMap;
	fstream m_dumpFile;
};